package Builder;
//构建者模式  适用于 构造稳定 但参数不稳定的
public class MilkyTea {
    //final固定它 让它不一样
    private final int suger;
    private final boolean ice;

    public MilkyTea(Builder builder)
    {
        this.suger=builder.suger;
        this.ice=builder.ice;
    }
    public int getSuger()
    {
        return suger;
    }
    public   static  class Builder
    {
        int suger;
        boolean ice=true;

        public Builder suger(int suger)
        {
            this.suger=suger;
            return this;
        }

        public Builder ice(boolean ice)
        {
            this.ice=ice;
            return this;
        }

        public  MilkyTea build()
        {
            return new MilkyTea(this);
        }

    }
}
